<ul id="widget">
					<li class="widget">
						<form method="get" action="<?php echo $this->url('home'); ?>/search" onsubmit="location.href=this.action+'/'+encodeURIComponent(this.s.value);return false;">
						<div>
							<input type="text" value="<?php echo htmlspecialchars($this->get('s')); ?>" name="s" />
							<input type="submit" value=" 搜索 " />
						</div>
						</form>
					</li>
					
					<li class="widget" style="padding:12px 0 6px 0;">
						<script type="text/javascript"><!--
						google_ad_client = "ca-pub-0848173796214649";
						/* sidebar */
						google_ad_slot = "9650045378";
						google_ad_width = 234;
						google_ad_height = 60;
						//-->
						</script>
						<script type="text/javascript" src="http://pagead2.googlesyndication.com/pagead/show_ads.js"></script>
					</li>
					
					<li class="widget">
						<h3>分类目录</h3>
						<ul><?php
							function category_children($m) {
								$str = "<ul>";
								foreach($m as $cat) {
									$str .= "<li><a ";
									if(!empty($cat->description)) $str .= "title=\"".$cat->description."\" ";
									$str .= "href=\"".$cat->url."\">";
									$str .= $cat->name;
									$str .= "</a>(".$cat->count.")";
									if(!empty($cat->children)) $str .= category_children($cat->children);
									$str .= "</li>";
								}
								$str .= "</ul>";
								return $str;
							}
							foreach($this->cache->get_term_by_name('category') as $cat) {
								echo "<li><a ";
								if(!empty($cat->description)) echo "title=\"".$cat->description."\" ";
								echo "href=\"".$cat->url."\">";
								echo $cat->name;
								echo "</a>(".$cat->count.")";
								if(!empty($cat->children)) echo category_children($cat->children);
								echo "</li>";
							}
						?></ul>
					</li>
					
					<li class="widget">
						<h3>文章归档</h3>
						<ul><?php
							foreach($this->cache->get_archive_by_date(20) as $row) {
								echo "<li>";
								echo "<a href=\"".$row->url."\" title=\"《".$row->title."》等相关文章\">";
								echo date("Y F", strtotime($row->date))."</a>&nbsp;($row->count)";
								echo "</li>";
							}
						?></ul>
					</li>
					
					<?php
					$simple_posts_title = ($this->template=='index') ? "随便看看" : "最新文章";
					$simple_posts_order = ($this->template=='index') ? "RAND()" : "`post_date` DESC";
					?>
					<li class="widget">
						<h3><?php echo $simple_posts_title;?></h3>
						<ul><?php
							foreach($this->cache->get_simple_posts_list(10, $simple_posts_order) as $row) {
								echo "<li>";
								echo "<a href=\"".$row->url."\" title=\"Posted at:".date("Y年m月d日 H:i", strtotime($row->date))."\">";
								echo $row->title."</a>";
								echo "</li>";
							}
						?></ul>
					</li>
					
					<li class="widget">
						<h3>标签</h3>
						<div class="tagcloud">
							<?php
							foreach($this->merge_tag_font_size($this->cache->get_term_by_name('post_tag')) as $row) {
								echo "<a href=\"".$row->url."\" title=\"".$row->count." 个话题\" style=\"font-size:".$row->size."pt;\">".$row->name."</a> ";
							}
							?>
						</div>
					</li>
					
					<li class="widget">
						<h3>友情链接</h3>
						<ul><?php
							foreach($this->cache->get_friend_site('blogs') as $row) {
								echo "<li>";
								echo "<a href=\"".$row->url."\"";
								if(!empty($row->description)) echo " title=\"".$row->description."\"";
								if(!empty($row->target)) echo " target=\"".$row->target."\"";
								echo ">";
								echo $row->name."</a>";
								echo "</li>";
							}
						?></ul>
					</li>
					
				</ul>